﻿<UserControl x:Class="nRoute.Samples.Netflix.Views.PeopleListingView"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:n="http://nRoute/schemas/2010/xaml"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
	xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" 
    xmlns:local_Controls="clr-namespace:nRoute.Samples.Netflix.Controls" 
	d:DesignHeight="600" d:DesignWidth="320" 
	n:Navigation.Title="People Listing"
    mc:Ignorable="d">

    <i:Interaction.Behaviors>
        <n:BridgeViewModelBehavior LoadedCommand="{Binding LoadDataCommand}"/>
    </i:Interaction.Behaviors>

    <Grid x:Name="LayoutRoot" Background="White">
    	
    	<Grid.RowDefinitions>
	        <RowDefinition Height="Auto"/>
	        <RowDefinition/>
	        <RowDefinition Height="60"/>
	    </Grid.RowDefinitions>
			<ListBox x:Name="DataListBox" BorderThickness="0,0,1,0" Padding="0" 
				ItemsSource="{Binding Listing}" Grid.Row="1" 
				ItemTemplate="{StaticResource TopicTitleTemplate}" 
				ItemContainerStyle="{StaticResource TopicTitleBoxItemStyle}" 
				ScrollViewer.HorizontalScrollBarVisibility="Disabled"
				ScrollViewer.VerticalScrollBarVisibility="Auto" Margin="0">
				<i:Interaction.Triggers>
					<i:EventTrigger EventName="SelectionChanged">
						<i:Interaction.Behaviors>
							<ei:ConditionBehavior>
								<ei:ConditionalExpression>
									<ei:ComparisonCondition LeftOperand="{Binding SelectedIndex, ElementName=DataListBox}" Operator="NotEqual" RightOperand="-1"/>
								</ei:ConditionalExpression>
							</ei:ConditionBehavior>
						</i:Interaction.Behaviors>
						<n:NavigateAction HandlerName="ContentContainer" Url="Content/Netflix/Person/" >
							<n:DependencyParameter Key="Person" Value="{Binding SelectedItem, ElementName=DataListBox}"/>
						</n:NavigateAction>
					</i:EventTrigger>
				</i:Interaction.Triggers>
			</ListBox>
			<Border Height="40" BorderBrush="#FF81868F" BorderThickness="0,0,1,0">				
				<i:Interaction.Behaviors>
					<n:BoolValueVisibilityBehavior Value="{Binding IsSearching}"/>
				</i:Interaction.Behaviors>
				<Grid Margin="12,0,1,0">				
					<TextBlock Margin="8,-3,42,0" TextWrapping="NoWrap" 
						Text="{Binding SearchText, FallbackValue=Search Results, StringFormat='Results for ΄{0}΄' }" 
						FontSize="16" Foreground="#FF8D8D8D" TextTrimming="WordEllipsis" 
						FontFamily="Segoe UI Light" d:LayoutOverrides="Height" VerticalAlignment="Center"/>
					<Button Style="{DynamicResource ChromeButtonStyle}" HorizontalAlignment="Right" Height="15" 
						Margin="0,0,12.396,0" VerticalAlignment="Center" Width="15" >
						<i:Interaction.Triggers>
							<i:EventTrigger EventName="Click">
								<n:ExecuteCommandAction Command="{Binding ClearSearchCommand}"/>
							</i:EventTrigger>
						</i:Interaction.Triggers>
						<Path Data="M7.9099998,7.4159999 L19.179824,20.778801 M19.40935,7.4540897 L7.9139289,20.582763" 
							Stretch="Fill" Stroke="#FF8D8D8D" 
							UseLayoutRounding="False" RenderTransformOrigin="0.160137526446591,0.114919132408156"/>
					</Button>
				</Grid>
			</Border>
			<Grid Grid.Row="2" Cursor="Hand" Background="Transparent">				
				<i:Interaction.Triggers>
					<i:EventTrigger EventName="MouseLeftButtonUp">
						<n:ExecuteCommandAction Command="{Binding LoadMoreCommand}"/>
					</i:EventTrigger>
				</i:Interaction.Triggers>			
				<i:Interaction.Behaviors>
					<n:BoolValueVisibilityBehavior Value="{Binding IsLoaded}" Negate="True"/>
					<n:BoolValueDisableBehavior Value="{Binding IsLoading}" DisableOpacity="0.2"/>
				</i:Interaction.Behaviors>
				<TextBlock Margin="40,-3,8,0" TextWrapping="NoWrap" 
					FontSize="16" Foreground="#FF8D8D8D" TextTrimming="WordEllipsis" 
					FontFamily="Segoe UI Light" d:LayoutOverrides="Height" VerticalAlignment="Center" Text="Load More Results" HorizontalAlignment="Center"/>
				<Path Data="M2.0241784,19.292285 C5.3602659,25.493272 13.09179,27.815839 19.293021,24.479882 25.494251,21.143925 27.816909,13.412704 24.480821,7.2117164 21.144734,1.0107285 13.41321,-1.311838 7.2119791,2.0241188 1.0107486,5.3600755 -1.311909,13.091296 2.0241784,19.292285 z M13.357,6.6164999 L13.357,20.6165 M6.361,13.483998 L20.361,13.483998" 
					HorizontalAlignment="Center" Margin="-125,0,8,0" Stretch="Fill" Stroke="#FF8D8D8D" 
					UseLayoutRounding="False" Width="26.505" VerticalAlignment="Center" 
					Height="26.504" RenderTransformOrigin="0.484383694582177,0.508401081789119"/>				
			</Grid>
			
			<local_Controls:WorkingIndicator IsWorking="{Binding IsLoading}" Grid.RowSpan="3"/>
    </Grid>
    
</UserControl>